<template>
    <div>
        <nav-layout :layout="layout" @clickLi="clickLi"></nav-layout>
        <div v-if="layout.indexof === 0">
            <v-form v-on:submitForm="submitForm"></v-form>
            <v-table  ref="Table"></v-table>
        </div>
        <total v-if="layout.indexof === 1"></total>
        <tota-designerl v-if="layout.indexof === 2 && listEnable"></tota-designerl>
    </div>
</template>
<script>
import navLayout from "@/views/NavLayout";
import vForm from "./form";
import vTable from "./table";
import totaDesignerl from "./totaDesigner";
import total from "./total";
import { checkPermission } from "@/utils/permissions";
export default {
    data() {
        return {
            layout: {
                nav: [],
                indexof: 0,
            },
            listEnable: checkPermission("visionDemand:dataSummary:designerDemandSum")
        };
    },
  created() {
      //检查权限
   this.navList();
    if(this.$route.query.value){
      this.layout.indexof = Number(this.$route.query.value)
    }
  },
    methods: {
      clickLi(index){
        window.location.href = "/#/OACenter/visualDesign/demandList?value=" + this.layout.indexof;
      },
       navList(){
         if(this.listEnable){
           this.layout.nav =  ["需求列表", "总统计", "设计师统计页面"]
         }else {
           this.layout.nav = ["需求列表","总统计"]
         }
       },
        submitForm(formData) {
            this.$nextTick(() => {
                this.$refs.Table.getData(formData)
            });
        }
    },
    components: {
        navLayout,
        total,
        totaDesignerl,
        vForm,
        vTable
    }
};
</script>
